import { http } from './../../utils/http'

// 提交报修
/* 入参：
{
  "image": file,
  "facilityId": number,
  "description": string
}
*/
export const submitRepair = (data: any) => {
  return http.post('/api/repair/submit', data)
}

// 获取报修列表
/* 入参：
{
  "current": number,
  "size": number
}
*/
export const getRepairList = (data: any) => {
  return http.get('/api/repair/page', data)
}

/* 文件上传 */
export const uploadFile = (data: any) => {
  return http.post('/api/file/upload', data)
}

/* 添加设施 */
/* 
{
    "name": "2号路灯",
    "categoryId": 1,
    "address": "湖北汽车工业学院正门",
    "longitude": "", // 为空就行
    "latitude": "" // 为空就行
}
*/
export const fetAdd = (data: any) => {
  return http.post('/api/staff/facility/add', data)
}

export const fetAllSheshi = () => {
  return http.get('/api/staff/facility/list', {
    current: 1,
    size: 1000,
  })
}

export const fetDepAllRepair = () => {
  return http.get('/api/staff/repair/list', {
    current: 1,
    size: 1000,
  })
}

/* 更新工单状态 */
interface IUpdateRepairStatus {
  orderId: number
  status: number
}
export const fetchUpdateRepairStatus = (data: IUpdateRepairStatus) => {
  return http.put('/api/staff/repair/status', data)
}
